<template>
  <div>

    <el-form :inline="true" :model="formInline" class="demo-form-inline">
     <el-form-item>
    <el-select style="width:120px" v-model="formInline.store_name" placeholder="选择部门">
      <el-option v-for="(item,index) in storeSelect" :label="item" :value="item"></el-option>
    </el-select>
    </el-form-item>
    <el-input style="width:400px" placeholder="请输入内容" v-model="input" class="input-with-select">
    <el-select style="width:110px" v-model="select" slot="prepend" placeholder="请选择">
      <el-option label="姓名" value="name"></el-option>
      <el-option label="编号" value="number"></el-option>
      <el-option label="联系电话" value="tel"></el-option>
    </el-select>
    </el-input>
   <el-form-item>
    <el-button type="primary" @click="onSubmit">查询</el-button>
    <el-button type="primary" @click="resetForm()">重置</el-button>
    </el-form-item>
    </el-form>
  </div>
</template>
<script>
  import {mapGetters,mapActions} from 'vuex'
  export default {
    name:'seach',
    props:['data'],
    data() {
      return {
        select:'',
        input:'',
        formInline: {}, 
        seachData:{}
      }
    },
    methods: {
      ...mapActions(['actGetygData']),
      onSubmit() {
        this.seachData = {}
        if(this.select != '' && this.input!= ''){
          this.seachData[this.select] = this.input
        }
        this.seachData.store_name = this.formInline.store_name
        // console.log(this.formInline.store_name)
        // JSON.stringify(this.seachData) == "{}"
        if(this.seachData.store_name != undefined || this.seachData[this.select] != undefined){
          this.$emit('seach',this.seachData)
        }
      },
      resetForm(formName) {
        // console.log(this.data)
        this.select = ''
        this.input = ''
        this.formInline = {}
        // let num = (this.data-1)*5
        this.actGetygData(0)
      }
    },
    computed:{
      ...mapGetters(['jobSelect','roleSelect','storeSelect'])
    }
  }
</script>